﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Task04
{
    public class Tree
    {
        private List<Tree> childs;
        public int? Value;
        public List<Tree> Childs
        {
            get
            {
                if (childs == null)
                {
                    childs = new List<Tree>();
                }
                return childs;
            }
        }
    }

    public class Program
    {
        static void Main(string[] args)
        {
            string input = Console.ReadLine();

            Tree tree = ReadTree(input);

            List<int> eachLevelCounts = new List<int>();
            int currentLevel = 1;

            if (tree.Value == null)
            {
                eachLevelCounts.Add(0);
            }
            else
            {
                eachLevelCounts.Add((int) tree.Value);
            }

            DFS(tree, eachLevelCounts, currentLevel);

            foreach (int count in eachLevelCounts)
            {
                Console.WriteLine(count);
            }
        }

        static Tree ReadTree(string input)
        {
            string substring = input.Substring(1, input.Length - 2);
            int index = 0;
            StringBuilder sb = new StringBuilder();
            while (index < substring.Length && ((index == 0 && substring[index] == '-') || char.IsDigit(substring[index])))
            {
                sb.Append(substring[index]);
                index++;
            }

            Tree tree;

            tree = new Tree()
            {
                Value = int.Parse(sb.ToString())
            };


            if (substring.Length >= 2 && substring[0] == '-' && char.IsDigit(substring[1]))
            {
                substring = substring.TrimStart("-0123456789".ToCharArray());
            }

            substring = substring.TrimStart("0123456789".ToCharArray());

            if (substring.Length >= 2 && (substring[0] == '>' || substring[1] == '>'))
            {
                substring = substring.TrimStart("->".ToCharArray());
            }


            if (substring.Length > 0)
            {
                List<string> branches = SplitBranches(substring);

                int leaf;
                foreach (var branch in branches)
                {
                    if (branch[0] == 'x')
                    {
                        tree.Childs.Add(new Tree()
                        {
                            Value = null
                        });
                    }
                    else
                    {
                        if (int.TryParse(branch, out leaf))
                        {
                            tree.Childs.Add(new Tree()
                            {
                                Value = leaf
                            });
                        }
                        else
                        {
                            tree.Childs.Add(ReadTree(branch));
                        }
                    }
                }
            }
            return tree;
        }

        static List<string> SplitBranches(string input)
        {
            List<string> split = new List<string>();
            int count = 0;
            StringBuilder sb = new StringBuilder();
            foreach (var ch in input)
            {
                if (ch == ',' && count == 0)
                {
                    split.Add(sb.ToString());
                    sb.Clear();
                    continue;
                }
                sb.Append(ch);
                if (ch == '(')
                {
                    count++;
                }
                if (ch == ')')
                {
                    count--;
                }
            }
            split.Add(sb.ToString());
            return split;
        }

        private static void DFS(Tree node, List<int> eachLevelCounts, int currentLevel)
        {
            foreach (Tree child in node.Childs)
            {
                if (eachLevelCounts.Count < currentLevel + 1)
                {
                    eachLevelCounts.Add(0);
                }

                if (child.Value != null)
                {
                    eachLevelCounts[currentLevel] += (int) child.Value;
                }

                DFS(child, eachLevelCounts, currentLevel + 1);
            }
        }
    }
}